package com.genesis.yunnanji.view;

import android.support.v4.app.Fragment;
import android.view.View;

import com.flyco.tablayout.SlidingTabLayout;
import com.genesis.yunnanji.R;
import com.genesis.yunnanji.adapter.ClassifySortAdapter;
import com.genesis.yunnanji.view.fragment.ConsumptionFragment;
import com.genesis.yunnanji.view.fragment.IncomeFragment;
import com.genesis.yunnanji.widget.NoScrollViewPager;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 创建日期：2018/9/26 on 11:34
 * 作者:Kite
 * 描述:积分
 */
public class EarningsActivity extends BaseActivity {

    @BindView(R.id.vp_content)
    NoScrollViewPager vpContent;

    @BindView(R.id.tabs)
    SlidingTabLayout tabs;

    private ArrayList<String> functionList = new ArrayList<>();//收入、消费按钮

    private List<Fragment> fragmentList = new ArrayList<>();

    @Override
    public int getLayoutId() {
        return R.layout.activity_earnings;
    }

    @Override
    public void initView() {
        super.initView();
        setTitle("积分");
        addMenuTextItem(R.string.earnings_rules, new View.OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });

        fragmentList.add(IncomeFragment.newInstance());
        fragmentList.add(ConsumptionFragment.newInstance());

        functionList.add("收入");
        functionList.add("消费");
        ClassifySortAdapter classifySortAdapter = new ClassifySortAdapter(getSupportFragmentManager(), fragmentList, functionList);
        vpContent.setAdapter(classifySortAdapter);
        tabs.setViewPager(vpContent);
        vpContent.setCurrentItem(0);
        vpContent.setOffscreenPageLimit(2);
    }


}
